import Vue from 'vue'
import VueRouter from 'vue-router'

import MyGoodsList from "@/views/MyGoodsList"
import MyGoodsSearch from "@/views/MyGoodsSearch"
import MyUserInfo from "@/views/MyUserInfo"
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/MyGoodsList'
  },
  {
    path: '/MyGoodsList',
    name: 'MyGoodsList',
    component: MyGoodsList,
  },
  {
    path: '/MyGoodsSearch',
    name: 'MyGoodsSearch',
    component: MyGoodsSearch,
  },
  {
    path: '/MyUserInfo',
    name: 'MyUserInfo',
    component: MyUserInfo,
  },
]

const router = new VueRouter({
  routes
})

// const isLogin = true
// router.beforeEach((to, from, next) => {
//   if (to.path === MyGoodsList && !isLogin) {
//     alert('请登录')
//     next(false)
//   } else {
//     next(true)
//   }
// })

export default router
